package com.zhuoyue.biz.core.api.dto.rep;

import com.zhuoyue.biz.core.api.domain.AppUserDO;
import lombok.Data;

/**
 * @author wjming
 * @ClassName: AppUserRepDTO
 * @Description: 用户对象信息回应
 * @Date 2021-06-28 12:52
 */
@Data
public class AppUserRepDTO extends BaseRepDTO {
    /**
     * 账号
     */
    private String account;

    /**
     * 昵称
     */
    private String nickName;
    /**
     * 头像
     */
    private String imgUrl;
    /**
     * Token 验证信息
     */
    private String token;
    /**
     * 推送类型
     */
    private String sourceType;
    /**
     * 推送ID
     */
    private String sourceId;
    /**
     * 推送标识
     */
    private String tsbz;
    /**
     * 微信开放平台ID
     */
    private String openidWeiXin;
    /**
     * qq开放平台ID
     */
    private String openidQQ;
    /**
     * 苹果开放平台ID
     */
    private String openidApple;
    /**
     * 组织编码
     */
    private String organizationCode;
    /**
     * 快速登录类型0，微信 1，QQ
     */
    private String type;

    /**
     * AppUserDO 数据转成DTO传输数据
     *
     * @param appUserDO
     * @return
     */
    public AppUserRepDTO appUserDoToAppUserRepDto(AppUserDO appUserDO) {
        if (appUserDO == null) {
            return null;
        }
        setId(appUserDO.getId());
        setCreateTime(appUserDO.getCreateTime());
        this.setAccount(appUserDO.getAccount());
        this.setNickName(appUserDO.getNickName());
        this.setImgUrl(appUserDO.getImgUrl());
        this.setToken(appUserDO.getToken());
        this.setSourceType(appUserDO.getSourceType().toString());
        this.setSourceId(appUserDO.getSourceId());
        this.setTsbz(appUserDO.getTsbz());
        this.setOpenidWeiXin(appUserDO.getOpenidWeiXin());
        this.setOpenidQQ(appUserDO.getOpenidQQ());
        this.setOpenidApple(appUserDO.getOpenidApple());
        this.setOrganizationCode(appUserDO.getOrganizationCode());
        this.setType(appUserDO.getType());
        return this;
    }
}
